﻿<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:Controls="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls" xmlns:Controls1="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="d">
    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="/MixModes.Synergy.Web.VisualFramework;component/Themes/Brushes.xaml" />
        <ResourceDictionary Source="/MixModes.Synergy.Web.VisualFramework;component/Themes/Buttons.xaml" />
    </ResourceDictionary.MergedDictionaries>

    <!-- Control template for docked content within windows manager-->
    <ControlTemplate x:Key="DockedContentTabItem"
                     TargetType="Controls:TabItem">

        <!--<ControlTemplate.Triggers>
            <Trigger Property="IsSelected"
                     Value="True">
                <Setter Property="Background"
                        Value="{StaticResource ActiveTabItemBackground}" />
                <Setter Property="Background"
                        TargetName="CloseButton"
                        Value="{StaticResource ActiveTabItemCloseButtonHoverBackground}" />
                <Setter Property="Visibility"
                        TargetName="CloseButton"
                        Value="Visible" />
                <Setter Property="Foreground"
                        Value="Black" />
            </Trigger>
            <Trigger Property="IsMouseOver"
                     Value="True">
                <Setter Property="Visibility"
                        TargetName="CloseButton"
                        Value="Visible" />
            </Trigger>
        </ControlTemplate.Triggers>-->

    	<Grid>
    		<VisualStateManager.VisualStateGroups>
    			<VisualStateGroup x:Name="SelectionStates">
    				<VisualState x:Name="Selected">
    					<Storyboard>
    						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="CloseButton">
    							<DiscreteObjectKeyFrame KeyTime="0">
    								<DiscreteObjectKeyFrame.Value>
    									<Visibility>Visible</Visibility>
    								</DiscreteObjectKeyFrame.Value>
    							</DiscreteObjectKeyFrame>
    						</ObjectAnimationUsingKeyFrames>
    						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="grid">
    							<DiscreteObjectKeyFrame KeyTime="0">
    								<DiscreteObjectKeyFrame.Value>
    									<Visibility>Visible</Visibility>
    								</DiscreteObjectKeyFrame.Value>
    							</DiscreteObjectKeyFrame>
    						</ObjectAnimationUsingKeyFrames>
    					</Storyboard>
    				</VisualState>
    			</VisualStateGroup>
    			<VisualStateGroup x:Name="CommonStates">
    				<VisualState x:Name="MouseOver">
    					<Storyboard>
    						<ObjectAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.Visibility)" Storyboard.TargetName="CloseButton">
    							<DiscreteObjectKeyFrame KeyTime="0">
    								<DiscreteObjectKeyFrame.Value>
    									<Visibility>Visible</Visibility>
    								</DiscreteObjectKeyFrame.Value>
    							</DiscreteObjectKeyFrame>
    						</ObjectAnimationUsingKeyFrames>
    					</Storyboard>
    				</VisualState>
    				<VisualState x:Name="Disabled"/>
    				<VisualState x:Name="Normal"/>
    			</VisualStateGroup>
    		</VisualStateManager.VisualStateGroups>

    		<Grid x:Name="grid" Visibility="Collapsed" Background="{StaticResource ActiveTabItemBackground}"/>

    		<Border BorderThickness="0"
    			CornerRadius="2,2,0,0"
    			Background="{TemplateBinding Background}"
    			d:LayoutOverrides="Width, Height">
            
    			<Controls1:DockPanel>

    				<Button x:Name="CloseButton"
    					Controls1:DockPanel.Dock="Right"
    					Style="{StaticResource DockPaneButton}"
    					Margin="0,0,4,0"
    					VerticalAlignment="Center"
    					Command="{Binding CloseCommand}"
    					Visibility="Collapsed"
    					Foreground="{TemplateBinding Foreground}"
    					CommandParameter="{Binding DataContext, RelativeSource={RelativeSource TemplatedParent}}">
                        <Grid>
                            <Grid Background="{StaticResource ActiveTabItemCloseButtonHoverBackground}"
                                  x:Name="CloseButtonHighlightGrid"
                                  Visibility="Collapsed" />
                            <Path Height="16"
    						    Width="16"
    						    Data="M4,4 L12,12 M12,4 L4,12"
    						    Stroke="{TemplateBinding Foreground}" />
                        </Grid>
                    </Button>

    				<ContentControl Content="{TemplateBinding Header}"
    					Margin="8,4,4,4"
    					Foreground="{TemplateBinding Foreground}"
    					VerticalAlignment="Center" />
                
    			</Controls1:DockPanel>
            
    		</Border>

    	</Grid>

    </ControlTemplate>
</ResourceDictionary>
